module FamilyTreeApi
  module Person
    class Information
      attr_accessor :alternate_ids, :gender, :living

      def initialize
        @alternate_ids = Array.new
      end

      def self.parse(info_element)
        unless info_element.nil?
          information = Information.new
          info_element.children.each do |e|
            case e.name
            when 'alternateIds'
              e.children.each do |id|
                information.alternate_ids << Id.new(id.content) if id.name == 'id'
              end
            when 'gender'
              information.gender = e.content
            when 'living'
              information.living = e.content
            end
          end
          information
        end
      end
    end
    
    class Id
      attr_accessor :value, :type #type not yet implemented
      def initialize(value)
        @value = value
      end
    end
  end
end